<?php 
$router = Zend_Controller_Front::getInstance()->getRouter(); 
 ?>

<h1>Recent Articles</h1>
<?php
        echo $this->navigation()->menu();
    ?>
<ul class="post-list">
<?php if ($this->data_page) foreach ($this->data_page as $post) {
	print "<li >";
	preg_match_all('/<img [^>]*src=["|\']([^"|\']+)/i', $post['content'], $matches);
	foreach ($matches[1] as $key=>$value) {
		echo "<div class=\"img-outer\"><img src=\"$value\"/></div>";
		break;
	}
	print "<a href=\"".
	$this->url(array('controller'=>'post','action' => 'view', 'id' => $post['alias']), 'post', true)
	."\">{$post['title']}</a>";
	if ($this->hasIdentity) {
		echo " <a href=\"".
	$this->url(array('module'=>'admin','controller'=>'post','action' => 'edit', 'id' => $post['id']))
	."\" class=\"ico-edit\"></a>";
	}
	
	if (preg_match('/^.{1,220}\b/s', strip_tags($post['content']), $match))
	{
		$line=$match[0];
	}
	
	echo "<p>$line</p><div class=\"clear\"></div></li>";
} ?>
</ul>
<?php 
       echo $this->paginationControl($this->data_page, 'Sliding' , 'pagination.phtml'); 
?>